﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace HighScore
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
            client.GetHighScoreCompleted += new EventHandler<ServiceReference1.GetHighScoreCompletedEventArgs>(client_GetHighScoreCompleted);
            client.GetHighScoreAsync(1);

        }

        void client_GetHighScoreCompleted(object sender, ServiceReference1.GetHighScoreCompletedEventArgs e)
        {
            List<ServiceReference1.HighScore> highscores = e.Result.ToList();
            dataGrid1.ItemsSource = highscores;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
            client.EditHighscoreCompleted += new EventHandler<ServiceReference1.EditHighscoreCompletedEventArgs>(client_EditHighscoreCompleted);
            client.EditHighscoreAsync(1, 120, 1);

            //client.InsertHighScoreCompleted += new EventHandler<ServiceReference1.InsertHighScoreCompletedEventArgs>(client_InsertHighScoreCompleted);
            //client.InsertHighScoreAsync(1, 12, 9);

        }

        void client_InsertHighScoreCompleted(object sender, ServiceReference1.InsertHighScoreCompletedEventArgs e)
        {
            //do wut
        }

        void client_EditHighscoreCompleted(object sender, ServiceReference1.EditHighscoreCompletedEventArgs e)
        {
            //do wut
        }

    }
}
